class csns::al9auth::service(){
# 执行 authselect 命令
exec { 'authselect_sssd':
  command => 'authselect select sssd with-mkhomedir --force',
  path    => '/usr/bin:/usr/sbin:/bin',
  unless  => 'authselect current | grep -q "Profile ID: sssd"',
  require => Class['csns::al9auth::config'],
}

# 启用并启动 oddjobd 服务
service { 'oddjobd':
  ensure => 'running',
  enable => true,
  require => Exec['authselect_sssd'],
}

# 启用并启动 sssd 服务
service { 'sssd':
  ensure => 'running',
  enable => true,
  require => [Exec['authselect_sssd'], Service['oddjobd']],
}
}
